﻿@using Microsoft.AspNet.Identity
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
{
    var username = User.Identity.GetUserName();
    @Html.AntiForgeryToken()

    @*<div class="navbar-image">
        @Html.GravatarImage(username, new GravatarOptions { Size = 30, CssClass = "img-circle" })
    </div>*@

    if (Request.IsAuthenticated)
    {
        using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
        {
        @Html.AntiForgeryToken()

        <ul class="nav navbar-nav navbar-right">
            @*<li>
                @Html.ActionLink("Bonjour " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
            </li>*@
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hello @username! <span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                    <li>
                        @Html.ActionLink("Manage Account", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
                    </li>
                    <li class="divider"></li>
                    @foreach (var theme in Bootstrap.Themes)
                    {
                        <li><a href="@Url.Action("ChangeTheme", "Profile", new { themename = theme})">@theme</a></li>
                    }
                </ul>
            </li>
            <li><a href="javascript:document.getElementById('logoutForm').submit()">Se déconnecter</a></li>
        </ul>
        }
    }
    else
    {
        <ul class="nav navbar-nav navbar-right">
            <li>@Html.ActionLink("S’inscrire", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
            <li>@Html.ActionLink("Se connecter", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
        </ul>
    }
}